/*
ID: guoxu1
PROG: castle
LANG: C++
*/
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

const int max_grid_side = 50;

const struct 
{
	int mask;
	int shift_c;
	int shift_r;
}walls[4] = { { 1, -1, 0 }, { 2, 0, -1 }, { 4, 1, 0 }, { 8, 0, 1 } };

struct Grid
{
	int wall;
	int room;

	Grid()
	{
		room = -1;
	}
};

struct Coor
{
	int r;
	int c;

	Coor( int _r, int _c ):r(_r),c(_c) {}
};

class Board
{
	int row;
	int column;

public:
	Grid grids[max_grid_side][max_grid_side];
	vector<int> roomsizes;

	Board( int _row, int _column ): row(_row), column(_column) {}

	void bfs( int r, int c )
	{
		if( grids[r][c].room != -1 ) return;

		size_t n = roomsizes.size();

		vector<Coor> poses;
		grids[r][c].room = n;
		poses.push_back( Coor(r, c) );

		size_t p = 0;
		while( p < poses.size() )
		{
			Coor x = poses[p++];
			for( int i = 0; i < 4; i++ )
			{
				if( ( grids[x.r][x.c].wall & walls[i].mask ) != 0 ) continue;
				Coor y( x.r + walls[i].shift_r, x.c + walls[i].shift_c );
				if( y.r < 0 || y.r >= row || y.c < 0 || y.c >= column ) continue;
				if( grids[y.r][y.c].room != -1 ) continue;
				grids[y.r][y.c].room = n;
				poses.push_back( y );
			}
		}

		roomsizes.push_back( poses.size() );
	}

	void findroom()
	{
		for( int r = 0; r < row; r++ )
		{
			for( int c = 0; c < column; c++ )
			{
				if( grids[r][c].room == -1 )
				{
					bfs( r, c );
				}
			}
		}
	}
};

#define cin fin
#define cout fout

int main()
{
	ifstream fin("castle.in");
	ofstream fout("castle.out");

	int column = 0, row = 0;
	cin >> column >> row;

	Board b( row, column );


	for( int r = 0; r < row; r++ )
	{
		for( int c = 0; c < column; c++ )
		{
			cin >> b.grids[r][c].wall;
		}
	}

	b.findroom();

	cout << b.roomsizes.size() << endl;
	int maxsize = *std::max_element( b.roomsizes.begin(), b.roomsizes.end() );
	cout << maxsize << endl;

	int mr = 0, mc = 0, mk = 0;
	for( int c = 0; c < column; c++ )
	{
		for( int k = 1; k <= 2; k++ )
		{
			for( int r = row - 1; r >=0; r-- )
			{
				if( ( b.grids[r][c].wall & walls[k].mask ) == 0 ) continue;
				if( r + walls[k].shift_r < 0 || c + walls[k].shift_c >= column ) continue;
				int room1 = b.grids[r][c].room;
				int room2 = b.grids[r + walls[k].shift_r][c + walls[k].shift_c].room;
				if( room1 == room2 ) continue;
				int newsize = b.roomsizes[room1] + b.roomsizes[room2];
				if( maxsize < newsize )
				{
					maxsize = newsize;
					mr = r;
					mc = c;
					mk = k;
				}
			}
		}
	}
	cout << maxsize << endl;
	cout << mr + 1 << " " << mc + 1 << " " << ( mk == 1 ? "N" : "E" ) << endl;

	return 0;
}
